﻿<%@ Control Language="C#" AutoEventWireup="true" CodeFile="MainPrdtShow.ascx.cs" Inherits="GoShopping.Web.UserControls.MainPrdtShow" %>
<div style="width: 655px; height:192px ; text-align:center;">
    <table border="0" cellpadding="0" cellspacing="0" class="style1">
        <tr>
            <td class="style4">
                <a id="redirectA" href="" runat="server"> <asp:Image ID="Image1" runat="server" Height="192px" Width="520px" /></a>
            </td>
        </tr>
        <tr>
            <td align="right" style=" padding-right:130px;">
                      <a ID="aPrdt1" href="" runat="server" onmouseover="ChangeImageAndBackColor(1)" onmouseout="RestoreColor()">1</a>
                &nbsp;<a ID="aPrdt2" href="" runat="server" onmouseover="ChangeImageAndBackColor(2)" onmouseout="RestoreColor()">2</a>
                &nbsp;<a ID="aPrdt3" href="" runat="server" onmouseover="ChangeImageAndBackColor(3)" onmouseout="RestoreColor()">3</a>
                &nbsp;<a ID="aPrdt4" href="" runat="server" onmouseover="ChangeImageAndBackColor(4)" onmouseout="RestoreColor()">4</a>
                &nbsp;<a ID="aPrdt5" href="" runat="server" onmouseover="ChangeImageAndBackColor(5)" onmouseout="RestoreColor()">5</a>
                &nbsp;<a ID="aPrdt6" href="" runat="server" onmouseover="ChangeImageAndBackColor(6)" onmouseout="RestoreColor()">6</a>
                &nbsp;<a ID="aPrdt7" href="" runat="server" onmouseover="ChangeImageAndBackColor(7)" onmouseout="RestoreColor()">7</a>
                &nbsp;<a ID="aPrdt8" href="" runat="server" onmouseover="ChangeImageAndBackColor(8)" onmouseout="RestoreColor()">8</a>
                
            </td>
        </tr>
    </table>
</div>
<p>
    &nbsp;</p>
<style type="text/css">
    .style1
    {
        width: 100%;
        height: 200px;
        text-align:center;
    }
    .style3
    {
        width: 130px;
    }
    .style4
    {
        height: 170px;
        
    }

    .style4 a:hover
    {
      cursor:hand;
     
    }
    
    LinkButton
    {
      color:Red;	
    }

</style>
<script type="text/javascript">
    function loadXMLDoc(dname)
    {
        try //Internet Explorer
          {
          xmlDoc=new ActiveXObject("Microsoft.XMLDOM");
          }
        catch(e)
          {
          try //Firefox, Mozilla, Opera, etc.
            {
            xmlDoc=document.implementation.createDocument("","",null);
            }
          catch(e) {alert(e.message)}
          }
        try 
          {
              xmlDoc.async=false;
              xmlDoc.load(dname);
              return(xmlDoc);
          }
        catch(e) {alert(e.message)}
        return(null);
    }
    var previousColor;
    function ChangeImageAndBackColor(num)
    {
      previousColor=window.event.srcElement.style.backgroundColor;
      window.event.srcElement.style.backgroundColor="#C7D1D0";
      var xmlDoc=loadXMLDoc("Config/PrdtConfig.xml");
      var nodes=xmlDoc.selectNodes("/Index/MainPrdt/pic");
      var ATag=document.getElementById("ctl00_ContentPlaceHolder1_MainPrdtShow1_redirectA");
      var arry=new Array();
      
      arry[num-1]=nodes[num-1].attributes;
      ATag.href="CommonProducts.aspx?prdtId="+arry[num-1].getNamedItem("Id").nodeValue;
      var A1=document.getElementById("ctl00_ContentPlaceHolder1_MainPrdtShow1_aPrdt"+num);
      A1.href="CommonProducts.aspx?prdtId="+arry[num-1].getNamedItem("Id").nodeValue;
      document.getElementById("ctl00_ContentPlaceHolder1_MainPrdtShow1_Image1").src=arry[num-1].getNamedItem("src").nodeValue;
//      alert(arry[num-1].getNamedItem("src").nodeValue);
    }
    
    function transfer(img)
    {
        alert(img.name);
        window.location.href="CommonProducts.aspx?prdtId="+img.name;
    }
    
    function RestoreColor()
    {
        window.event.srcElement.style.backgroundColor=previousColor;
    }
</script>
